//http-proxy-middleware是代理中间件
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
 app.use('/api', createProxyMiddleware({
   target: 'http://localhost:8080',
     // 如果设置成true：发送请求头中host会设置成target·
   changeOrigin: true,
 }))
}